/**
* All Rights Reserved , Copyright (C) 2023 , 青岛鼎信通讯股份有限公司
*
* AppModuleIconService
* 模块图标
*
* 修改纪录
* 2023-01-13 版本：1.0 hudeyong 创建。
* @version 版本：1.0
* @author 作者：hudeyong
* 创建日期：2023-01-13
*/
package com.topscomm.appv2.service.impl;

import com.topscomm.appv2.pojo.AppModuleIconEntity;
import com.topscomm.basic.exception.ServiceException;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.topscomm.appv2.service.IAppModuleIconService;
import com.topscomm.appv2.service.impl.auto.AppModuleIconServiceAuto;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service(value = "appModuleIconService")
@Scope(value = "singleton")
public class AppModuleIconService extends AppModuleIconServiceAuto implements IAppModuleIconService {

    @Override
    public String queryModuleIcon(String id) {
        try {
            Map<String, Object> map = new HashMap<String, Object>();
            map.put("id", id);
            AppModuleIconEntity entity = null;
            List<AppModuleIconEntity> list = this.dao.query(map, "queryByte");
            if (list.size() > 0) {
                entity = list.get(0);
            }
            if (entity != null && entity.getModuleicon() != null) {
                return new String(entity.getModuleicon(), "UTF-8");
            } else {
                return "";
            }
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    public List<AppModuleIconEntity> queryAllModuleIcon(Map<String, Object> map) {
        try {
            return this.dao.query(map, "queryAllByte");
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }
}
